<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="com.are.odisea.*"%>
<%@ page import="com.are.manejadores.*"%>
<%@ page import="java.util.*"%>
<%@include file="validausuario.jsp" %>
<%
	String categoria = (String) request.getParameter("categoria");
	db conexion = new db();
	ManejadorPerfiles mp = new ManejadorPerfiles(conexion);
	if (!mp.AllowAccessPage((String)session.getAttribute("perfil"),"DOC")) {
		conexion.Close();
		response.sendRedirect("accesodenegado.jsp");
		return;
	}
	
	ManejadorCategoria mc = new ManejadorCategoria(conexion);
	Categoria objCategoria = new Categoria();
	if (mc.Find(Integer.parseInt(categoria))) {
		objCategoria = mc.getCategoria();
	}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Agregar Documento</title>
<link rel="stylesheet" href="themes/redmond/jquery.ui.all.css">
<LINK REL="stylesheet" TYPE="text/css" HREF="main.css">
<script src="ui/jquery-1.8.0.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.core.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.widget.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.button.js"></script>
	<script src="ui/jquery.effects.core.js"></script>
	<script src="ui/jquery.effects.slide.js"></script>
	<script src="ui/jquery.ui.datepicker.js"></script>
	<script src="ui/jquery.effects.explode.js"></script>
	<script src="ui/jquery.effects.fold.js"></script>
	<script src="ui/jquery.effects.slide.js"></script>

<script type="text/javascript">
$(function() {
		$("input:submit, a, button", ".main").button();
		$("input:button, a, button", ".main").button();
		
		$( "#fecha" ).datepicker({
			showOn: "button",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true,
			dateFormat: "yy-mm-dd"
		});
		$( "#fecha" ).datepicker( "option", "showAnim", "slide" );
		
	});

</script>
</head>

<body>
	<div class="main">

		<form name="form1" id="form1" method="post"
			enctype='multipart/form-data' action="SrvUploadDocumentos">
			<table>
				<tr>
					<th colspan="2">Agregar documento</th>
				</tr>
				<tr>
					<td>Categoria</td>
					<td><%=objCategoria.getDescripcion()%> <input type="hidden" id="Categorias" name="Categorias" value="<%= objCategoria.getId() %>"></td>
				</tr>
				<tr>
					<td>Descripcion</td>
					<td><textarea name="Descripcion" id="Descripcion" rows="5"
							cols="40"></textarea></td>
				</tr>
				<tr>
					<td>Fecha de Publicacion</td>
					<td><input type="text" id="fecha" name="fecha" value="" size="10" /></td>
				</tr>
				<tr>
					<td>Archivo</td>
					<td><input id="documento" name="documento" type="file" /></td>
				</tr>
				<tr class="odd">
					<td colspan=2>
					<input type="submit" name="cmd_agregar" id="cmd_agregar" value="Agregar Documento"> 
					<input type="button" name="cmd_Cancel" id="cmd_Cancel" value="Cancelar" onclick="javascript:window.close();">
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>
<%
	if (conexion != null) {
		conexion.Close();
	}
%>